<?php session_start();
include "../conexao.php";

$login = mysql_real_escape_string($_POST['login']);
$senha = mysql_real_escape_string($_POST['senha']);

if ($login=="" || $senha=="") {echo "<META HTTP-EQUIV=REFRESH CONTENT = '0;URL=index.php'>
		<script type \"text/javascript\">
			alert(\"digite seu login e senha !! !!\");
		</script>"; exit();}
     
	
	
	$sql  = mysql_query("SELECT * from usuario where login = '$login' and senha = '$senha'");
	$rows = mysql_num_rows ($sql);
	
	if ($rows ==""){
	
		echo "<META HTTP-EQUIV=REFRESH CONTENT = '0;URL=index.php'>
		<script type \"text/javascript\">
			alert(\"usuario ou senha incorretos !!\");
		</script>"; exit();
		
		
		}else{ 
		
		$_SESSION['txt_login']= mysql_result($sql,0,'Nome');
		
		echo "<script> location.href=\"principal.php\"; </script>";}




?>